import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { AuthGuard } from '../../shared/auth-guard.service';

import { AdminComponent } from './admin.component';
import { AdminDockComponent } from './admin-dock.component';
import { ManageHomeComponent } from './manage-home.component';
import { ManageAboutComponent } from './manage-about.component';

const routes: Routes = [
  {
    path: '',
    component: AdminComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: '',
        canActivateChild: [AuthGuard],
        children: [
          { path: 'home', component: ManageHomeComponent },
          { path: 'about', component: ManageAboutComponent },
          { path: '', component: AdminDockComponent }
        ]
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class AdminRoutingModule { }
